 #Region "Header"
'Title:     Selection Structures Lab
'Author:    Greg Cronk
'Date:      02/25/2014
'Course:    CSC 162
'Section:   401
'Description:   This program allows the user to enter 2 strings converts a numeric string into a letter then parses the 2 values out.
'
'Initial Algorithm:
'   1.  Get Course Name and Numeric Grade from user
'   2.  Convert numeric grade to a Letter Grade
'   3.  Display the Course with the Letter Grade in the Output
'   4.  Store the Course and Letter Grade and append to a Static
'
'Data Requirements:
'   Input:
'       Course Name and Numeric Grade
'   Output:
'       Words listed by alphabetical order
'   
'
'Formulas:
'  A >= 90
'  B >= 80
'  C >= 70
'  D >= 60
'  Anything below 60 = F
'
'Refine Algorith In Subs as used.
#End Region
Public Class Form1
    Private Sub btnResults_Click(sender As System.Object, e As System.EventArgs) Handles btnResults.Click

        'If Course Name Text is a number Then
        '  Display message box asking for a non-numeric entry
        '  If Grade Text is a number Then
        '    If Grade Text < 60 
        '      Grade = F
        '    ElseIf Grade Text >= 60 Then
        '      Grade = D
        '    ElseIf Grade Text >= 70 Then
        '      Grade = C
        '    ElseIf Grade Text >= 80 Then 
        '      Grade = B
        '    Else Grade Text >= 90 Then
        '      Grade = A
        '    End If
        '  Else 
        '    Display message box asking for a Numeric Value
        '  EndIf 
        'Else 
        '  Course = Course Name Text
        ' Display Course and Grade in Output Label and add New Line
        ' Output Static = Output Label text

        'Declare Varibles.
        Static CompileGrades As String
        Dim CourseName As String
        Dim ltrGrade As String
        Dim intGrade As Integer

        'Check or Numeric Only Entry for Course Name
        If IsNumeric(txtCourse.Text) = False Then
            CourseName = txtCourse.Text

            'Assign Letter Grades to Numeric Grade Values
            If IsNumeric(txtGrade.Text) Then
                intGrade = txtGrade.Text
                If intGrade >= 90 Then
                    ltrGrade = "A"
                ElseIf intGrade >= 80 Then
                    ltrGrade = "B"
                ElseIf intGrade >= 70 Then
                    ltrGrade = "C"
                ElseIf intGrade >= 60 Then
                    ltrGrade = "D"
                Else
                    ltrGrade = "F"
                End If

            Else
                'Prompt the User to give a numeric Grade Value
                Dim TextEntry As String
                TextEntry = MsgBox("Please Enter a Numeric Value")
                txtGrade.Focus()
            End If
        Else
            'Prompt the User to give a Alpha Numeric Title for the Course.
            Dim NumericEntry As String
            NumericEntry = MsgBox("Please Enter The Course Alpha-Numeric Title")
            txtCourse.Focus()
        End If

        'Output the Results and Store the information in the Compiled Data
        lblOutput.Text = CourseName & " " & ltrGrade & CompileGrades
        CompileGrades = ControlChars.NewLine & lblOutput.Text

    End Sub

    Private Sub btnExit_Click(sender As System.Object, e As System.EventArgs) Handles btnExit.Click
        'Close the Window and Release the Used Memory
        Me.Close()
        End
    End Sub

End Class
